<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>商品分类</title>
    <%@ include file="common.jsp"%>
    <script type="text/javascript" src="/static/js/product.js"></script>
    <script>
        $(function () {
            $.get('/product/selectByCount.do',function (data) {
                $("#totalProduct").html(data);
            })
            $.get('/product/selectByAvg.do',function (data) {
                $("#avgPrice").html(data.toFixed(2));
            })
        })
    </script>
</head>
<body>
<table>
    <tr>
        <td>
            <div id="p" class="easyui-panel" style="width:295px;height:150px;background-color: lightsalmon">
                <p style="font-size:14px">共有商品</p>
                <p style="font-size:25px ;" align="center"><span style="color: red"><i
                        id="totalProduct"></i>&nbsp;种</span></p>
               <%-- <p style="font-size:14px">库存低于
                    <span style="color: red"><i>10件</i>的有</span>
                    <span style="color: red"><i id="someProduct">21</i>件</span>商品</p>--%>
            </div>
        </td>

        <td>

            <div  class="easyui-panel" style="width:295px;height:150px;background-color: darkgray">
                <p style="font-size:14px">商品均价</p>
                <p style="font-size:25px ;" align="center"><span style="color: red"><i
                        id="avgPrice"></i>&ensp;元</span></p>
            </div>
        </td>
        <td>
            <div class="easyui-panel" style="width:295px;height:150px; background-color: #a5cf4c">
                <p style="font-size:14px">库存低于</p>
                <p style="color: red;font-size:25px" align="center"><span><i>10</i></span>&nbsp;件 </p>
                <p>的有<span style="color: red" align="center"><i id="lessProduct">0</i>&nbsp;件</span>商品</p>
            </div>
        </td>
        <td>
            <div class="easyui-panel" style="width:295px;height:150px; background-color: #2a85a1">
                <p style="font-size:14px"></p>
                <p style="font-size:25px;color: red;" align="center" >销量最高产品</p>
                <p style="font-size:25px ;" align="center"><span style="color: darkblue">
                        <i>冈本003--口香糖</i></span></p>
            </div>
        </td>
    </tr>
</table>

    <table id="pro_datagrid"></table>
    <div id="pro_detailview"></div>
<form id="pro_queryForm" method="post">
    <div id="pro_toolbar">
        <a class="easyui-linkbutton" iconCls="icon-add" data-method="add" plain="true">新增</a>
        <a class="easyui-linkbutton" iconCls="icon-edit"  data-method="edit" plain="true">编辑</a>
        <a class="easyui-linkbutton" iconCls="icon-remove" plain="true" data-method="remove">删除</a>
        <a class="easyui-linkbutton" iconCls="icon-reload" plain="true" data-method="reload">刷新</a>
        <%--<a class="easyui-linkbutton" iconCls="icon-clear"  data-method="importData" plain="true">导入</a>--%>
        <a class="easyui-linkbutton" iconCls="icon-dog"  data-method="export" plain="true">导出</a>
        <%-- 高级查询,要有name因为导入的时候要提交参数--%>
        一级分类:<input type="text" style="width: 120px" name="firstId" id="firstId" class="easyui-combobox"
                    data-options="url:'/productFirst/selectAll.do',textField:'name',valueField:'id',panelHeight:'auto',editable:true">
        二级分类:<input type="text" style="width: 120px" name="secondId" id="secondId" class="easyui-combobox"
                    data-options="textField:'classify',valueField:'id',panelHeight:'auto',editable:true">

            <input id="keyword" style="width: 120px" class="easyui-textbox" name="keyword" style="width:150px" data-options="prompt:'关键字'" >
            <a class="easyui-linkbutton" iconCls="icon-search"  data-method="query" plain="true">搜索</a>
        </form>
    </div>

    <div id="pro_dialog" style="margin-top: 15px">
        <form method="post" id="pro_form" enctype="multipart/form-data">
            <input type="hidden" name="id" id="proId">
            <input type="hidden" name="headImg" id="headImg">
            <table align="center">
                <tr>
                    <td>一级分类:
                    <td>
                        <input id="firstSelected" style="width: 300px; height: 32px;" class="easyui-combobox"
                               name="first.id"
                               data-options="url:'/productFirst/selectAll.do',valueField:'id',textField:'name',
                                         panelHeight:'auto',editable:true">
                    </td>
                </tr>
                <tr>
                    <td>二级分类:</td>
                    <td>
                        <input id="secSelected" style="width: 300px; height: 32px;"  class="easyui-combobox"
                               name="second.id"
                               data-options="textField:'classify',valueField:'id',panelHeight:'auto',editable:true">
                    </td>
                </tr>
                <tr>
                    <td>商品名</td>
                    <td><input class="easyui-textbox" name="name"/></td>
                </tr>
                <tr>
                    <td>商品编码</td>
                    <td><input class="easyui-textbox" name="sn"/></td>
                </tr>
                <tr>
                    <td>商品图片</td>
                    <td><input class="easyui-filebox" name="img" buttonText="请上传图片" /></td>
                </tr>
                <tr>
                    <td>货品进价</td>
                    <td><input class="easyui-textbox" name="costPrice"/></td>
                </tr>
                <tr>
                    <td>销售单价</td>
                    <td><input class="easyui-textbox" name="salePrice"/></td>
                </tr>
                <tr>
                    <td>会员售价</td>
                    <td><input class="easyui-textbox" name="countPrice"/></td>
                </tr>
                <tr>
                    <td>备注信息</td>
                    <td><input class="easyui-textbox" name="remark"/></td>
                </tr>
                <tr>
                    <td>积分</td>
                    <td><input class="easyui-textbox" name="integral"/></td>
                </tr>
            </table>
        </form>
    </div>

    <%--导入数据弹出框--%>
    <div id="pro_importData" style="margin-top: 15px" align="center">
        <form method="post" action="/product/importData.do" id="file_form" enctype="multipart/form-data">
            <input type="file" name="file" ><br/>
            <span class="importDataMsg"></span>
        </form>
    </div>
</body>
</html>
